package com.manlost.web.controller.baby;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.manlost.biz.ManlostServiceLocator;
import com.manlost.biz.baby.BabyService;
import com.manlost.biz.baby.model.dataobject.Baby;
import com.manlost.biz.baby.query.BabyQuery;
import com.manlost.biz.common.ibatis.PageQueryList;

@Controller
public class BabyAjaxController {

    private BabyService babyService = ManlostServiceLocator.getBabyService();

    @RequestMapping("/getBabys")
    @ResponseBody
    public Map<String, Object> searchItemsList(Integer startNum, Integer pageSize) {
        Map<String, Object> map = new HashMap<String, Object>();
        BabyQuery query = new BabyQuery();
        query.setStartRow(startNum);
        query.setPageSize(pageSize);
        PageQueryList<Baby> result = babyService.listBabys(query);
        map.put("result", result);
        map.put("totalPage", result.getTotalPage());
        return map;
    }
}
